package com.michael.study.customview.animation

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import com.michael.study.customview.R
import com.michael.study.customview.databinding.ActivityAnimationBinding
import com.michael.study.library.utils.Actions

/**
 * https://qijian.blog.csdn.net/article/details/50995268
 */
class AnimationActivity : AppCompatActivity(), View.OnClickListener {

    private lateinit var mBinding : ActivityAnimationBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        mBinding = ActivityAnimationBinding.inflate(layoutInflater)
        setContentView(mBinding.root)
        title = "动画"
        mBinding.btnXml.setOnClickListener(this)
        mBinding.btnInterpolator.setOnClickListener(this)
        mBinding.btnCode.setOnClickListener(this)
        mBinding.btnValueAnimator.setOnClickListener(this)

    }

    override fun onClick(v: View?) {
        when(v?.id) {
            R.id.btn_xml -> {
                Actions.startActivity(this,XmlAnimationActivity::class.java)
            }

            R.id.btn_interpolator -> {
                Actions.startActivity(this,InterpolatorActivity::class.java)
            }

            R.id.btn_code -> {
                Actions.startActivity(this,CodeAnimationActivity::class.java)
            }

            R.id.btn_value_animator -> {
                Actions.startActivity(this,ObjectAnimatorActivity::class.java)
            }
        }
    }
}